package cn.wolfcode.shop.cloud.msg;

import cn.wolfcode.shop.cloud.common.CodeMsg;

import java.text.MessageFormat;

public class MemberCodeMsg extends CodeMsg {
    public MemberCodeMsg(int code, String msg) {
        super(code, msg);
    }

    public MemberCodeMsg() {
    }

    public static final MemberCodeMsg USERNAME_PASSWORD_NULL = new MemberCodeMsg(50001, "用户名或密码不能为空");
    public static final MemberCodeMsg USER_NOT_EXIST = new MemberCodeMsg(50002, "用户不存在");
    public static final MemberCodeMsg USER_PASSWORD_ERROR = new MemberCodeMsg(50003, "密码不正确");
    public static final MemberCodeMsg PARAMETER_ERROR = new MemberCodeMsg(50004, "参数异常:{0}");

    public MemberCodeMsg FilterArgs(String... arg) {
        MemberCodeMsg memberCodeMsg = new MemberCodeMsg();
        memberCodeMsg.setCode(this.getCode());
        memberCodeMsg.setMsg(MessageFormat.format(this.getMsg(),arg));
        return  memberCodeMsg;
    }
}
